package 第2节数组;

import java.util.Scanner;

public class LianXi03 {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int row = input.nextInt();
        int col = input.nextInt();
        int target = input.nextInt();
        int[][] matrix = new int[row][col];
        for (int i = 0; i < row; i++) {
            for (int j = 0;j < col; j++) {
                matrix[i][j] = input.nextInt();
            }
        }
        int x = row - 1;
        int y = 0;
        //O(m + n)
        while (matrix[x][y] != target) {
            if (matrix[x][y] < target) {
                y++;
            } else {
                x--;
            }
            if (x < 0 || y >= col) {
                System.out.println("找不到");
                break;
            }
        }
        System.out.println(x + " " + y);
    }
}
